/*
 * Application\Src\gpsfix.h
 *
 * Gpsfix function
 *
 * Author: Chao-Chi Kuo <chaochi_kuo@systech.com.tw>
 * Copyright (c) 2010 SYSTEMS & TECHNOLOGY CORP. <http://www.systech.com.tw/>
 * All rights reserved.
 *
 * Modifications:
 * 2009/11/18 Chao-Chi Kuo	first implemetation
 *
 * $Id: gpsfix.h 196 2010-08-05 01:54:48Z chaochi_kuo $
 */
#ifndef __GPSFIX_H_
#define __GPSFIX_H_

#ifdef  __cplusplus
extern "C" {
#endif		/* __cplusplus */

#include "type.h"

typedef struct _GPS_FIX_DATA {
	DATE_TIME time;
	double latitude;
	double longitude;
	float altitude;
	float speed;			///< Speed over ground, 000.0 ~ 999.9 knots
	float course;			///< Course over ground, 000.0 ~ 359.9 degrees
	float hdop;
	unsigned char sat_num;
}GPS_FIX_DATA;

typedef struct _AGPS_INFO {
	unsigned long update_time;
	double latitude;
	double longitude;
	unsigned short update_data_len;
	unsigned char checksum;
}AGPS_INFO;

typedef enum {
	GPS_OFF 	= 0,
	GPS_ON		= 1,
	GPS_DELAY	= 2,
	GPS_FIX		= 3,
	GPS_NOT_FIX	= 4,
	GPS_END		= 5,
}GPS_STATUS;

extern AGPS_INFO agps_info;
extern GPS_FIX_DATA *pGPSFix;
extern GPS_STATUS gps_state;


extern void GPS_FIX_Init(void);
extern void AGPS_Init(void);
extern void GPS_FIX_Hook(void);
extern void UpdateRTC_Hook(void);
extern void AGPS_Send_Data(void);
extern unsigned char GPS_Calc_Sat_Num(void);
extern void UpdateRTC(void);

#ifdef __cplusplus
}
#endif	/* __cplusplus */
#endif	/* __GPSFIX_H_ */